package club.calong.sanniu.pojo;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

@Data
public class WxUser {

    String openid ;
    String nickname ;
    int sex ;
    String province ;
    String city ;
    String country ;
    String headimgurl ;
    String unionid ;

    public static WxUser ConvertToWXUser (JSONObject jsonObject) {
        WxUser user = new WxUser();
        user.openid = jsonObject.getString("openid").toString();
        user.nickname = jsonObject.getString("nickname").toString();
        user.sex = jsonObject.getInteger("sex");
        user.province = jsonObject.getString("province");
        user.country = jsonObject.getString("country");
        user.city = jsonObject.getString("city");
        user.headimgurl = jsonObject.getString("headimgurl");
        user.unionid = jsonObject.getString("unionid");
        return  user;
    }
}
